<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>验证年龄</title>
    <style type="text/css">
        span{color: #ff0000; padding-left: 5px; font-size: 12px;}
    </style>
</head>

<body>
   年龄： <input id="age" type="text"/><span id="divAge"></span>
   <script  src="js/jquery-1.12.4.js"></script>
   <script>
   $("#age").blur(function(){
    let age = $(this).val();
     let reg =/^120$|^((1[0-1]|[1-9])?\d)$/ 
     if(reg.test(age)==false){
        $("#divAge").html("错误")
     }else{
        $("#divAge").html("√")

     }

   })

   </script>
  
</body>
</html>
